package subdesgin;

import java.util.Scanner;


public class Mainfunc {
	public static void main(String[] args) {

	    lottery lot = new lottery();
	    lotteryfunc func= new lotteryfunc();
	    int num;
	 
	  
	    Scanner sc=new Scanner(System.in);
	    System.out.println("---欢迎进入彩票销售中心---");
	   
	    System.out.println("------- 1.用户注册 -------");
	    System.out.println("                         ");
	    System.out.println("------- 2.用户登录-------");
	    System.out.println("                         ");
	    System.out.println("------- 3.购买彩票 -------");
	    System.out.println("                         ");
	    System.out.println("------- 4.彩票开奖 -------");
	    System.out.println("                         ");
	    System.out.println("------- 5. 兑     奖    -------");
	    System.out.println("                         ");
	    System.out.println("------- 6. 退     出    -------");
	    System.out.println("                         ");
	    System.out.println("----请选择你要的功能-------");
	    
	    boolean fog=true;
	    while(fog){
	    	num=sc.nextInt();
	    	if(num==1){
	    		func.register();
	             fog=false;}
	    	if(num==2){
	    		func.landing();
	    		fog=false;
	    	}
	    	if(num==3){
	    		lot.setBuyl(func.buyl());
	    		lot.setBuyday(func.buyday());
		        lot.setResult(func.result());
		        fog=false;}	
		     if(num==4){
		    	 for(int i : lot.getResult()){
		 	        System.out.print(i + " ");
		 	    }
		 	    System.out.println();
		 	    fog=false;}
	         if(num==5){
	        	System.out.println("【购买时间: 】" + lot.getBuyday());  
	      	    int winNums = func.getresult(lot.getBuyl(), lot.getResult());
	      	    int money = func.winmoney(winNums);
	      	    lot.setWinmoney(money);
	      	    System.out.println("中奖个数：" + winNums);
	      	    System.out.println("您的中奖金额为：" + money);
	      	    fog=false;
	         }
	         if(num==6){
	        	 System.out.println("程序已退出");
	        	 break;
	         }
	        System.out.println("---请选择你要的功能---");
	        fog=true;
	}

	    }
	}



